import type { NfcConfig } from './type'

const nfcConfig: NfcConfig = {
  broadcastPrefix: '',
  secret: '',
  discoverRssi: -100
}

function init(config: NfcConfig) {
  for (let key in config) {
    if (config[key] !== undefined) {
      nfcConfig[key] = config[key]
    }
  }
}

function setConfig(config: Partial<NfcConfig>) {
  for (let key in config) {
    if (config[key] !== undefined) {
      nfcConfig[key] = config[key]
    }
  }
}

export {
  nfcConfig, init, setConfig
}

export type {
  NfcConfig
}